package com.buyantech.smweb.service;

import java.util.List;

import javacommon.base.BaseManager;
import javacommon.base.EntityDao;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.org.rapid_framework.page.Page;

import com.buyantech.smweb.dao.UserDao;
import com.buyantech.smweb.model.User;
import com.buyantech.smweb.vo.query.UserQuery;

/**
 * @author Albert email:albert(a)buyantech.com
 * @version 1.0
 * @date 2012-05-10
 */

@Service
@Transactional
public class UserManager extends BaseManager<User,java.lang.String>{

	private UserDao userDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	
	@Override
	public EntityDao getEntityDao() {
		return this.userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}


	@Transactional(readOnly=true)
	public Page findPage(UserQuery query) {
		return userDao.findPage(query);
	}
	@Transactional(readOnly=true)
	public Page searchPage(UserQuery query) {
		return userDao.searchPage(query);
	}
	
	@Transactional(readOnly=true)
	public Page searchPage1(UserQuery query) {
		return userDao.searchPage1(query);
	}

	public List<User> login(String username,String pwd){
		return userDao.findByUsernameOrPwd(username, pwd);
	}
}
